﻿using ChatApplicationClient.Areas.Api.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace ChatApplicationClient.Areas.Api.Controllers
{
    public class RoomsController : ApiController
    {
        private WebClient request;

        public RoomsController()
        {
            request = new WebClient();
        }

        // GET api/<controller>
        public string Get()
        {
            request.Headers.Add("Accept", "application/json");
            var rooms = request.DownloadString(Constants.ChatRoomsServiceUrl);
            return rooms;
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            request.Headers.Add("Accept", "application/json");
            var room = request.DownloadString(Constants.ChatRoomsServiceUrl+"/"+id);
            return room;
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
    }
}